const fs = require("fs");
const path = require("path");
const XLSX = require("xlsx");

path.resolve(__dirname, "games.xlsx")
// 读取excel文件
const workBook = XLSX.readFile(path.resolve(__dirname, "games.xlsx"));
// 表名称
const sheetName = workBook.SheetNames[0];
// 读取表格内容
const worksheet = workBook.Sheets[sheetName];

// 拿到转化为json的内容
const jsonData = XLSX.utils.sheet_to_json(worksheet);

fs.writeFileSync(path.resolve(__dirname, "public/games.json"), JSON.stringify(jsonData));